package com.mall.common.util;

/**
 * @author Mark
 * @date 2020/7/20 23:35
 * @description 人类
 */
public class Person {

    private String name;

    private Integer age;

    private Person() {

    }

    private Person(String name, Integer age) {
        this.name = name;
        this.age = age;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public static void eat() {
        System.out.println("eat is ok");
    }

    public static void drike() {
        System.out.println("drike is ok");
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }

    public static void main(String[] args) {
        // 人的属性
        Person person = new Person();
        person.setName("wang");
        person.setAge(1);
        System.out.println("person = " + person.toString());

        // 人的属性
        Person person02 = new Person("wang", 1);
        System.out.println("person02 = " + person02.toString());

        // 人的行为
        Person.drike();
        Person.eat();

        // 比较两个人的内涵(引用地址)
        System.out.println("person.equals(person02)= " + person.equals(person02));
        System.out.println((person.getName()).equals(person02.getName()));
    }
}
